home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / MultiSession 1.04 Source / Core 27⁄June⁄1993 / CCheckbox.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-16  |  2.7 KB  |  98 lines  |  [TEXT/KAHL]

  1. /* CCheckbox.c */
  2.  
  3. #include "CCheckbox.h"
  4. #include "CWindow.h"
  5. #include "Memory.h"
  6.  
  7.  
  8. /* */            CCheckbox::~CCheckbox()
  9.     {
  10.         ERROR(Initialized != True,PRERR(ForceAbort,
  11.             "CCheckbox::~CCheckbox called on uninitialized object."));
  12.         ReleaseHandle(Name);
  13.     }
  14.  
  15.  
  16. void            CCheckbox::ICheckbox(LongPoint Start, LongPoint Extent, Handle NameString,
  17.                         char Key, short Modifiers, short TheFontID, short ThePointSize,
  18.                         CWindow* TheWindow, CEnclosure* TheEnclosure)
  19.     {
  20.         ERROR(Initialized == True,PRERR(ForceAbort,
  21.             "CCheckbox::ICheckbox called on already initialized object."));
  22.         EXECUTE(Initialized = True);
  23.         Name = NameString;
  24.         ERROR(NameString==NIL,PRERR(ForceAbort,"CCheckbox::ICheckbox passed NIL for name."));
  25.         IButton(Start,Extent,Key,Modifiers,TheWindow,TheEnclosure);
  26.         State = False;
  27.         FontID = TheFontID;
  28.         PointSize = ThePointSize;
  29.     }
  30.  
  31.  
  32. void            CCheckbox::RedrawNormal(void)
  33.     {
  34.         long        Top,Left,Right,Bottom;
  35.  
  36.         ERROR(Initialized != True,PRERR(ForceAbort,
  37.             "CCheckbox::RedrawNormal called on uninitialized object."));
  38.         SetUpPort();
  39.         Window->ResetPen();
  40.         if (!Enabled)
  41.             {
  42.                 Window->SetGreyishTextOr();
  43.             }
  44.         Left = 0;
  45.         Top = (Extent.y / 2) - 6;
  46.         Right = 12;
  47.         Bottom = 12;
  48.         Window->LEraseRect(LongPointOf(Left + 1,Top + 1),LongPointOf(Right - 1,Bottom - 1));
  49.         Window->LFrameRect(LongPointOf(Left,Top),LongPointOf(Right + 1,Bottom + 1));
  50.         if (State)
  51.             {
  52.                 Window->DrawLine(LongPointOf(Left,Top),LongPointOf(Right,Bottom));
  53.                 Window->DrawLine(LongPointOf(Left,Top + Bottom),LongPointOf(Right,-Bottom));
  54.             }
  55.         Window->SetText(FontID,0,srcOr,PointSize,0);
  56.         if (!Enabled)
  57.             {
  58.                 Window->SetGreyishTextOr();
  59.             }
  60.         Window->LTextBox(LongPointOf(12+6,0),LongPointOf(Extent.x-(12+6),Extent.y),
  61.             Name,JustifyLeft);
  62.     }
  63.  
  64.  
  65. void            CCheckbox::RedrawHilited(void)
  66.     {
  67.         long        Top,Left,Right,Bottom;
  68.  
  69.         ERROR(Initialized != True,PRERR(ForceAbort,
  70.             "CCheckbox::RedrawHilited called on uninitialized object."));
  71.         SetUpPort();
  72.         Window->ResetPen();
  73.         Left = 0;
  74.         Top = (Extent.y / 2) - 6;
  75.         Right = 12;
  76.         Bottom = 12;
  77.         Window->LEraseRect(LongPointOf(Left + 2,Top + 2),LongPointOf(Right - 3,Bottom - 3));
  78.         Window->LFrameRect(LongPointOf(Left,Top),LongPointOf(Right + 1,Bottom + 1));
  79.         Window->LFrameRect(LongPointOf(Left + 1,Top + 1),LongPointOf(Right - 1,Bottom - 1));
  80.         if (State)
  81.             {
  82.                 Window->DrawLine(LongPointOf(Left,Top),LongPointOf(Right,Bottom));
  83.                 Window->DrawLine(LongPointOf(Left,Top + Bottom),LongPointOf(Right,-Bottom));
  84.             }
  85.         Window->SetText(FontID,0,srcOr,PointSize,0);
  86.         Window->LTextBox(LongPointOf(12+6,0),LongPointOf(Extent.x-(12+6),Extent.y),
  87.             Name,JustifyLeft);
  88.     }
  89.  
  90.  
  91. MyBoolean    CCheckbox::DoThang(void)
  92.     {
  93.         ERROR(Initialized != True,PRERR(ForceAbort,
  94.             "CCheckbox::DoThang called on uninitialized object."));
  95.         State = !State;
  96.         return False;
  97.     }
  98.